/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: GodK
 * Date: 2024-03-19
 * Time: 13:38
 */
public class Test {
    public static int missingNumber(int[] nums) {
        int sum = 0 ;
        int i = 0 ;
        for(;i<nums.length; i++){
            sum = sum + nums[i] - i;
        }
        sum-=i;
        if(sum<0){
            return -sum;
        }else{
            return -sum;
        }
    }
    public static void main(String[] args) {
        int[] arr = {0,1,2};
        System.out.println(missingNumber(arr));
    }
}
